﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using DataInfo;
using XBLib.Dal;
using XBLib.Dal.AdoDal;
using XBLib.BusinessObject;
using System.Data.Common;
using KenLib.BusinessObject;
namespace KenLib.Dal
{
    public class 応募情報Dao : BaseAdoDao
    {
        #region //Thanh Dong
        //List table 応募情報
        public DataTable frmJ_TraineeListSelect_Select()
        {
            DbCommand dbcommand = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeListSelect_Select_Dong, CommandType.StoredProcedure);
            return _daoHelper.Query(dbcommand);
        }

        //Insert data to table 応募情報
        public int frmJ_TraineeResumeBInput_Update(応募情報 _応募情報)
        {
            DbParameter dbParam0 = _daoHelper.CreateParameter("@ID", _応募情報.ID, DbType.Int32);
            DbParameter dbParam1 = _daoHelper.CreateParameter("@姓", _応募情報.姓, DbType.String);
            DbParameter dbParam2 = _daoHelper.CreateParameter("@名", _応募情報.名, DbType.String);
            DbParameter dbParam3 = _daoHelper.CreateParameter("@写真", _応募情報.写真, DbType.String);
            DbParameter dbParam4 = _daoHelper.CreateParameter("@身長", _応募情報.身長, DbType.String);
            DbParameter dbParam5 = _daoHelper.CreateParameter("@体重", _応募情報.体重, DbType.String);
            DbParameter dbParam6 = _daoHelper.CreateParameter("@視力", _応募情報.視力, DbType.Int32);
            DbParameter dbParam7 = _daoHelper.CreateParameter("@配偶者有無", _応募情報.配偶者有無, DbType.Boolean);
            DbParameter dbParam8 = _daoHelper.CreateParameter("@家族構成", _応募情報.家族構成, DbType.String);
            DbParameter dbParam9 = _daoHelper.CreateParameter("@海外渡航歴有無", _応募情報.海外渡航歴有無, DbType.Boolean);
            DbParameter dbParam10 = _daoHelper.CreateParameter("@在日親族有無", _応募情報.在日親族有無, DbType.Boolean);
            DbParameter dbParam11 = _daoHelper.CreateParameter("@在日親族状況", _応募情報.在日親族状況, DbType.String);
            DbParameter dbParam12 = _daoHelper.CreateParameter("@電話番号", _応募情報.電話番号, DbType.String);
            DbParameter dbParam13 = _daoHelper.CreateParameter("@携帯番号", _応募情報.携帯番号, DbType.String);
            DbParameter dbParam14 = _daoHelper.CreateParameter("@Email", _応募情報.Email, DbType.String);
            DbParameter dbParam15 = _daoHelper.CreateParameter("@現住所", _応募情報.現住所, DbType.String);
            DbParameter dbParam16 = _daoHelper.CreateParameter("@趣味", _応募情報.趣味, DbType.String);
            DbParameter dbParam17 = _daoHelper.CreateParameter("@日本語学習経験", _応募情報.日本語学習経験, DbType.Int32);
            DbParameter dbParam18 = _daoHelper.CreateParameter("@就業経験有無", _応募情報.就業経験有無, DbType.Int32);
            DbParameter dbParam19 = _daoHelper.CreateParameter("@経験作業名1", _応募情報.経験作業名1, DbType.Int32);
            DbParameter dbParam20 = _daoHelper.CreateParameter("@経験作業名2", _応募情報.経験作業名2, DbType.Int32);
            DbParameter dbParam21 = _daoHelper.CreateParameter("@経験作業名3", _応募情報.経験作業名3, DbType.Int32);
            DbParameter dbParam22 = _daoHelper.CreateParameter("@具体的仕事内容", _応募情報.具体的仕事内容, DbType.String);
            DbCommand command = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeResumeBInput_Update_Dong, CommandType.StoredProcedure, dbParam0, dbParam1, dbParam2, dbParam3, dbParam4, dbParam5, dbParam6, dbParam7, dbParam8, dbParam9, dbParam10, dbParam11, dbParam12, dbParam13, dbParam14, dbParam15, dbParam16, dbParam17, dbParam18, dbParam19, dbParam20, dbParam21, dbParam22);
            return _daoHelper.Execute(command);
        }

        //Get 1 record from table 応募情報 by id

        public DataTable frmJ_TraineeResumeAInput_SelectByID(int id)
        {
            DbParameter dbParamter1 = _daoHelper.CreateParameter("@ID", id, DbType.Int32);
            DbCommand dbcomman = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeResumeAInput_SelectByID_Dong, CommandType.StoredProcedure, dbParamter1);
            return _daoHelper.Query(dbcomman);
        }

        public int frmJ_TraineeResumeAInput_Update(応募情報 _応募情報)
        {
            DbParameter dbParam1 = _daoHelper.CreateParameter("@ID", _応募情報.ID, DbType.Int32);
            DbParameter dbParam2 = _daoHelper.CreateParameter("@姓", _応募情報.姓, DbType.String);
            DbParameter dbParam3 = _daoHelper.CreateParameter("@名", _応募情報.名, DbType.String);
            DbParameter dbParam4 = _daoHelper.CreateParameter("@性別", _応募情報.性別, DbType.Boolean);
            DbParameter dbParam5 = _daoHelper.CreateParameter("@生年月日", _応募情報.生年月日, DbType.DateTime);
            DbParameter dbParam6 = _daoHelper.CreateParameter("@国籍", _応募情報.国籍, DbType.Int32);
            DbParameter dbParam7 = _daoHelper.CreateParameter("@出身地", _応募情報.出身地, DbType.String);
            DbParameter dbParam8 = _daoHelper.CreateParameter("@ID番号", _応募情報.ID番号, DbType.String);
            DbParameter dbParam9 = _daoHelper.CreateParameter("@ID番号発行日", _応募情報.ID番号発行日, DbType.DateTime);
            DbParameter dbParam10 = _daoHelper.CreateParameter("@発行機関", _応募情報.発行機関, DbType.String);
            DbParameter dbParam11 = _daoHelper.CreateParameter("@宗教", _応募情報.宗教, DbType.String);
            DbParameter dbParam12 = _daoHelper.CreateParameter("@民族", _応募情報.民族, DbType.String);
            DbParameter dbParam13 = _daoHelper.CreateParameter("@最終学歴", _応募情報.最終学歴, DbType.String);
            DbCommand command = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeResumeAInput_Update_Dong, CommandType.StoredProcedure, dbParam1, dbParam2, dbParam3, dbParam4, dbParam5, dbParam6, dbParam7, dbParam8, dbParam9, dbParam10, dbParam11, dbParam12, dbParam13);
            return _daoHelper.Execute(command);
        }

        public DataTable frmJ_TraineeResumeTranslate_SelectByID(int id)
        {
            DbParameter dbParamter1 = _daoHelper.CreateParameter("@ID", id, DbType.Int32);
            DbCommand dbcomman = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeResumeTranslate_SelectByID_Dong, CommandType.StoredProcedure, dbParamter1);
            return _daoHelper.Query(dbcomman);
        }

        public int frmJ_TraineeResumeTranslate_update(int ID, string 姓_日本語, string 名_日本語, string 宗教_日本語, string 民族_日本語, string 家族構成_日本語, string 在日親族状況_日本語, string 趣味_日本語)
        {
            DbParameter dbParam1 = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);
            DbParameter dbParam2 = _daoHelper.CreateParameter("@姓_日本語", 姓_日本語, DbType.String);
            DbParameter dbParam3 = _daoHelper.CreateParameter("@名_日本語", 名_日本語, DbType.String);
            DbParameter dbParam4 = _daoHelper.CreateParameter("@宗教_日本語", 宗教_日本語, DbType.String);
            DbParameter dbParam5 = _daoHelper.CreateParameter("@民族_日本語", 民族_日本語, DbType.String);
            //DbParameter dbParam6 = _daoHelper.CreateParameter("@最終学歴_日本語", 最終学歴_日本語, DbType.String);
            DbParameter dbParam7 = _daoHelper.CreateParameter("@家族構成_日本語", 家族構成_日本語, DbType.String);
            DbParameter dbParam8 = _daoHelper.CreateParameter("@在日親族状況_日本語", 在日親族状況_日本語, DbType.String);
            DbParameter dbParam9 = _daoHelper.CreateParameter("@趣味_日本語", 趣味_日本語, DbType.String);
            DbCommand command = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeResumeTranslate_update_Dong, CommandType.StoredProcedure, dbParam1, dbParam2, dbParam3, dbParam4, dbParam5, dbParam7, dbParam8, dbParam9);
            return _daoHelper.Execute(command);
        }

        public DataTable frmJ_TraineeAppAssignCheck_Select_Grv(int int_団体ID, int int_企業ID, DateTime dt_面接日)
        {
            DbParameter dbParam1 = _daoHelper.CreateParameter("@団体ID", int_団体ID, DbType.Int32);
            DbParameter dbParam2 = _daoHelper.CreateParameter("@企業ID", int_企業ID, DbType.Int32);
            DbParameter dbParam3 = _daoHelper.CreateParameter("@面接日", dt_面接日, DbType.DateTime);
            DbCommand dbcomman = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeAppAssignCheck_Select_Grv_Dong, CommandType.StoredProcedure, dbParam1, dbParam2, dbParam3);
            return _daoHelper.Query(dbcomman);
        }

        public DataTable frmJ_TraineeSearch_Search(int 年齢1, int 年齢2, bool? 性別, int 最終学歴1, int 最終学歴2, bool? 就業経験有無, int 身長, int 体重1, int 体重2, int 視力, int 日本語学習経験, int 経験作業名, DateTime? 面接日, int 団体ID, int 企業ID)
        {
            DbParameter dbParam1 = _daoHelper.CreateParameter("@年齢1",年齢1 , DbType.Int32);
            DbParameter dbParam2 = _daoHelper.CreateParameter("@年齢2",年齢2 , DbType.Int32);
            DbParameter dbParam3 = _daoHelper.CreateParameter("@性別", 性別, DbType.Boolean);
            DbParameter dbParam4 = _daoHelper.CreateParameter("@最終学歴1",最終学歴1 , DbType.Int32);
            DbParameter dbParam5 = _daoHelper.CreateParameter("@最終学歴2",最終学歴2 , DbType.Int32);
            DbParameter dbParam6 = _daoHelper.CreateParameter("@就業経験有無", 就業経験有無, DbType.Boolean);
            DbParameter dbParam7 = _daoHelper.CreateParameter("@身長",身長 , DbType.Int32);
            DbParameter dbParam8 = _daoHelper.CreateParameter("@体重1",体重1 , DbType.Int32);
            DbParameter dbParam9 = _daoHelper.CreateParameter("@体重2",体重2 , DbType.Int32);
            DbParameter dbParam10 = _daoHelper.CreateParameter("@視力",視力 , DbType.Int32);
            DbParameter dbParam11 = _daoHelper.CreateParameter("@日本語学習経験", 日本語学習経験, DbType.Int32);
            DbParameter dbParam12 = _daoHelper.CreateParameter("@経験作業名",経験作業名 , DbType.Int32);
            DbParameter dbParam13 = _daoHelper.CreateParameter("@面接日", 面接日, DbType.DateTime);
            DbParameter dbParam14 = _daoHelper.CreateParameter("@団体ID", 団体ID, DbType.Int32);
            DbParameter dbParam15 = _daoHelper.CreateParameter("@企業ID", 企業ID, DbType.Int32);

            DbCommand dbcommand = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeSearch_Search_Dong, CommandType.StoredProcedure, dbParam1, dbParam2, dbParam3, dbParam4, dbParam5, dbParam6, dbParam7, dbParam8, dbParam9, dbParam10, dbParam11, dbParam12, dbParam13, dbParam14, dbParam15);
            return _daoHelper.Query(dbcommand);
        }

        public DataTable frmJ_TraineeResumeBInput_SelectByID(int ID)
        {
            DbParameter dbparam = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);
            DbCommand dbcomman = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeResumeBInput_SelectByID_Dong, CommandType.StoredProcedure, dbparam);
            return _daoHelper.Query(dbcomman);
        }

        public DataTable frmJ_TraineeWorkedCompInput_Select生年月日_応募情報(int ID)
        {
            DbParameter dbpram = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);
            DbCommand dbcomman = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeWorkedCompInput_Select生年月日_応募情報_Dong, CommandType.StoredProcedure, dbpram);
            return _daoHelper.Query(dbcomman);
        }

        public DataTable frmJ_TraineeSearch_CheckExists応募情報(DateTime 面接日, int 団体ID, int 企業ID)
        {
            DbParameter dbpram1 = _daoHelper.CreateParameter("@面接日", 面接日, DbType.DateTime);
            DbParameter dbpram2 = _daoHelper.CreateParameter("@団体ID", 団体ID, DbType.Int32);
            DbParameter dbpram3 = _daoHelper.CreateParameter("@企業ID", 企業ID, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeSearch_CheckExists応募情報_Dong, CommandType.StoredProcedure, dbpram1, dbpram2, dbpram3);
            return _daoHelper.Query(dbcommand);
        }
        #endregion
        #region Mai
        public DataTable ShowGrid応募情報(int int_団体ID, int int_企業ID, DateTime dt_面接日)
        {
            try
            {
                DbParameter param = _daoHelper.CreateParameter("@団体ID", int_団体ID, DbType.Int32);
                DbParameter param1 = _daoHelper.CreateParameter("@企業ID", int_企業ID, DbType.Int32);
                DbParameter param2 = _daoHelper.CreateParameter("@面接日", dt_面接日, DbType.DateTime);
                DbCommand dbcommand = _daoHelper.CreateCommand("sp_frmJ_TraineeAppAssignConfirm_ShowGrid応募情報_Mai", CommandType.StoredProcedure, param, param1, param2);
                return _daoHelper.Query(dbcommand);
            }catch(Exception e){
                return null;
            }
        }
        public void Update_frmJ_TraineeAppAssignConfirm(int oj)
        {
            DbParameter param = _daoHelper.CreateParameter("@承認", oj, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_frmJ_TraineeAppAssignConfirm_Update応募情報_Mai", CommandType.StoredProcedure, param);
            _daoHelper.Query(dbcommand);
        }

        public void Update_TraineeAppAssignConfirm(int oj)
        {
            DbParameter param = _daoHelper.CreateParameter("@承認", oj, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_frmJ_TraineeAppAssignConfirm_Update応募情報_Luclt", CommandType.StoredProcedure, param);
            _daoHelper.Query(dbcommand);
        }
        #endregion

        #region Phuong
        public DataTable frmJ_TraineeResumeOutput_Search(応募情報 obj)
        {
            DbParameter param = _daoHelper.CreateParameter("@団体ID", obj.団体ID, DbType.Int32);
            DbParameter param1 = _daoHelper.CreateParameter("@企業ID", obj.企業ID, DbType.Int32);
            DbParameter param2 = _daoHelper.CreateParameter("@面接日", obj.面接日, DbType.DateTime);
            DbCommand dbcommand = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TraineeResumeOutput_Search_Phuong, CommandType.StoredProcedure, param, param1, param2);
            return _daoHelper.Query(dbcommand);
        }
        public DataTable sp_frmJ_TestResultInput_dll応募者(int ID)
        {
            DbParameter param = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);

            DbCommand dbcommand = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TestResultInput_dll応募者, CommandType.StoredProcedure, param);
            return _daoHelper.Query(dbcommand);
        }
        public DataTable sp_frmJ_TestResultInput_dll応募者All(int ID)
        {

            DbParameter param = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TestResultInput_dll応募者All, CommandType.StoredProcedure, param);
            return _daoHelper.Query(dbcommand);
        }
        public void sp_frmJ_TestResultInput_Update(応募情報 obj)
        {
            DbParameter param = _daoHelper.CreateParameter("@ID", obj.ID, DbType.Int32);
            DbParameter param1 = _daoHelper.CreateParameter("@点数", obj.数学テスト結果点数1, DbType.Int32);
            DbParameter param2 = _daoHelper.CreateParameter("@回答率", obj.数学テスト結果回答率, DbType.Int32);
            DbParameter param3 = _daoHelper.CreateParameter("@性格診断結果", obj.性格診断結果, DbType.String);

            DbCommand dbcommand = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TestResultInput_Update, CommandType.StoredProcedure, param, param1, param2, param3);
            _daoHelper.Execute(dbcommand);

                    
        }
        public DataTable sp_frmJ_TestResultInput_Load(Int32 ID)
        {
            DbParameter param = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);

            DbCommand dbcommand = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_TestResultInput_Load, CommandType.StoredProcedure, param);
            return _daoHelper.Query(dbcommand);
        }
        
        #endregion

        #region Hunglt
        public DataTable SelectData応募情報(int 組合選択, int 組合員企業選択, string 面接日)
        {
            DbParameter param団体ID = _daoHelper.CreateParameter("@団体ID", 組合選択, DbType.Int32);
            DbParameter param企業ID = _daoHelper.CreateParameter("@企業ID", 組合員企業選択, DbType.Int32);
            DbParameter param面接日 = _daoHelper.CreateParameter("@面接日", 面接日, DbType.DateTime);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_frmJ_InterviewResultSearch_SEARCH応募情報_Hunglt", CommandType.StoredProcedure,
                param団体ID, param企業ID, param面接日);
            return _daoHelper.Query(dbcommand);
        }
        #endregion

    }
}
